package de.slothsoft.wasbinich.android.util;

import android.view.View;
import android.widget.TextView;

public final class ViewUtil {

    public static void setText(View view, String rawText) {
	String actualText = rawText == null ? "" : rawText; //$NON-NLS-1$
	if (view instanceof TextView) {
	    ((TextView) view).setText(actualText);
	} else {
	    System.err.println("View is of no class to set text on: " + view); //$NON-NLS-1$
	}
    }

    public static String getText(View view) {
	if (view instanceof TextView)
	    return ((TextView) view).getText().toString();
	System.err.println("View is of no class to set text on: " + view); //$NON-NLS-1$
	return null;
    }

    private ViewUtil() {
	// hide me
    }

}
